package com.introduce.extract;


/**
 * 重构前
 *
 * @author: cong zhi
 * @createDate: 2022/5/10 9:05
 * @updateUser: cong zhi
 * @updateDate: 2022/5/10 9:05
 * @updateRemark: 修改内容
 * @version: v1.0
 */
public class HelloWord {

    public static void main(String[] args) {

        System.out.println("Hello Java");

        //不正常的客户
        Site site = new Site();
        Customer Customer1 = site.getCustomer();
        String strName = Customer1.getName();
        // 顾客名字
        System.out.println("Current Customer1: " + strName);

        BillingPlan plan1 = Customer1.getPlan();
        System.out.println("Total Expand:" + plan1.getTotalExpand());

        if (!Customer1.isNull()) {
            System.out.println("Customer1 is not null customer");
        } else {

            System.out.println("Customer1 is null customer");
        }
        System.out.println();

        /**
         * 正常客户
         */
        BillingPlan plan2 = new BillingPlan(101, 19);
        PaymentHistory history2 = new PaymentHistory();
        Customer cus = new Customer("xiaoming", plan2, history2);
        site.setCustomer(cus);

        Customer cus2 = site.getCustomer();
        strName = cus2.getName();
        System.out.println("Current Customer2: "+strName);
        cus2.getPlan();
        System.out.println("Total Expand:"+plan1.getTotalExpand());
        if (!cus2.isNull()) {
            System.out.println("Customer2 is not null customer");
        } else {
            System.out.println("Customer2 is null customer");
        }
        int weeksDelinquent;

        if (cus2.isNull()) {
            weeksDelinquent = 0;
        }else {
            weeksDelinquent = cus.getHistory().getWeeksDelinquentInLastYear();
        }
        System.out.println("weeksDelinquent=:"+weeksDelinquent);

    }
}
